﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Diagnostics;
using System.IO;
using ForumLibrary.Data;

public partial class MasterPage : System.Web.UI.MasterPage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["username"] != null)
        {
            string username = Session["username"].ToString();

            WelcomeLabel.Text = "Welcome " + username;
            WelcomeLabel.Visible = true;

            LogoutLink.Visible = true;
        }
        else
        {
            if (!Request.AppRelativeCurrentExecutionFilePath.Equals("~/Login.aspx") && !Request.AppRelativeCurrentExecutionFilePath.Equals("~/Register.aspx"))
                Response.Redirect("~/Login.aspx");
        }
        if (Request.AppRelativeCurrentExecutionFilePath.Equals("~/Login.aspx"))
        {
            WelcomeLabel.Visible = false;
            LogoutLink.Visible = false;
        }
        //Session["Timer"] = new Timer();

    }
}
